import os
import yaml

# Project Folder
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

# Load yaml configuration
env = os.getenv('FLASK_ENV')
if env == 'DEV':
    config_file = os.path.join(BASE_DIR, 'config', 'dev_config.yaml')
elif env == 'QA':
    config_file = os.path.join(BASE_DIR, 'config', 'qa_config.yaml')
elif env == 'PROD':
    config_file = os.path.join(BASE_DIR, 'config', 'prod_config.yaml')
else:
    config_file = os.path.join(BASE_DIR, 'config', 'qa_config.yaml')

with open(config_file, 'r') as file:
    config = yaml.safe_load(file)

# DB info
server = config['database']['server']
database = config['database']['database']
username = config['database']['username']
password = config['database']['password']
driver = config['database']['driver']

# report engine
rpt_server = config['report-engine']['server']
rpt_port = config['report-engine']['port']

# compass web
cmp_server = config['compass-web']['server']
cmp_port = config['compass-web']['port']
super_user_username = config['compass-web']['super-user']['username']
super_user_password = config['compass-web']['super-user']['password']
super_user_domain = config['compass-web']['super-user']['domain']
expired_token = config['compass-web']['expired-token']
